/*
 * comlan
 */

package com.promfy.timetable.ui;


import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

import com.promfy.timetable.R;
import com.promfy.timetable.domain.OneClass;

public class OneClassView extends LinearLayout implements OnClickListener{

	
	private Handler handler = new Handler(){

		@Override
		public void handleMessage(Message msg) {
			int what = msg.what;
			switch (what) {
			
			default:
				break;
			}
			super.handleMessage(msg);
		}
		
	};
	
	private LayoutInflater inflater;
	private Context context;
	private View view;
	private TableLayout tableLayout;

	private TextView course;

	private TextView location;

	private TextView teacher;

	private LinearLayout linear;

	private OneClass oneClass;
	
	public OneClass getOneClass() {
		return oneClass;
	}



	public void setOneClass(OneClass oneClass) {
		this.oneClass = oneClass;
	}



	public LinearLayout getLinear() {
		return linear;
	}



	public void setLinear(LinearLayout linear) {
		this.linear = linear;
	}



	public TextView getCourse() {
		return course;
	}



	public void setCourse(TextView course) {
		this.course = course;
	}



	public TextView getLocation() {
		return location;
	}



	public void setLocation(TextView location) {
		this.location = location;
	}



	public TextView getTeacher() {
		return teacher;
	}



	public void setTeacher(TextView teacher) {
		this.teacher = teacher;
	}



	public OneClassView(Context context, OneClass oneClass) {
		super(context);
		this.context = context;
		this.oneClass = oneClass;
		
		initView();
		initData();
	}

	
	
	public OneClassView(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
	}



	private void initView(){
		inflater = LayoutInflater.from(context);
		view = inflater.inflate(R.layout.one_class, this);
		course = (TextView) view.findViewById(R.id.course_one_class);
		location = (TextView) view.findViewById(R.id.location_one_class);
		teacher = (TextView) view.findViewById(R.id.teacher_one_class);
		linear = (LinearLayout) view.findViewById(R.id.linear_one_class);
		
	}
	
	public void setClassDetail(String courseStr, String locationStr, String teacherStr){
		course.setText(courseStr);
		location.setText(locationStr);
		teacher.setText(teacherStr);
	}
	
	private void initData() {
	
	}
	
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		//restart
		case 1:
		
			break;
		//back to mode
		case 2:

			break;
		//exit
		case 3:
			
			break;
		default:
			break;
		}
	}

	@Override
	public void setBackgroundColor(int color) {
		// TODO Auto-generated method stub
		getLinear().setBackgroundColor(color);
	}

}
